#coding:utf8

import jieba

# 通过jieba分词器进行分词
def cut_key_word(text):
    r = jieba.cut_for_search(text)
    l = list()
    for word in r :
        if word not in ['谷','班','课']:
            l.append(filter(word))
    return l

# 过滤特定字符
def filter(data):
    if data == '传智播': return '传智播客'
    if data == '博学': return '博学谷'
    if data == '院校': return '院校帮'
    return data

# 将搜索结果分词后，返回成 usrId_keyWord,1 的形式
def cut_usr_key_word(usr,content):
    key_words = cut_key_word(content)
    result = list()
    for key in key_words:
        result.append((usr+'_'+key,1))
    return result